<template>
<div>
  <el-dialog
    title="账户使用状态编辑"
    :visible.sync="edit_acco"
    width="30%"
    :before-close="handleClose">
    <span>
      编辑该用户使用状态：
      <el-select v-model="value" placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </span>
    <span slot="footer" class="dialog-footer">
      <el-button @click="click_btn">取 消</el-button>
      <el-button type="primary" @click="click_btn">确 定</el-button>
    </span>
  </el-dialog>
</div>

</template>

<script>
export default {
  name: 'EditAccount',
  props: {
    editbool: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      edit_acco: this.editbool,
      value: '',
      options: [{
        value: 'yes',
        label: '已使用'
      },
      {
        value: 'no',
        label: '未使用'
        }]
    }
  },
  watch: {
    editbool(newval, oldval){
      this.edit_acco = newval
    }
  },
  methods:{
    click_btn(){
      this.edit_acco = false;
      this.$emit('single_events',this.value);
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
          this.edit_acco = false;
          this.$emit('single_events',this.value);
        })
        .catch(_ => {});
    }
  }
}
</script>

<style scoped>

</style>
